package com.yurui.service.impl;

import com.yurui.mapper.StorageMapper;
import com.yurui.service.StorageService;
import io.seata.core.context.RootContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author : yurui
 * @date : 2023/10/22
 * @TIME : 19:34
 * @project : parentCloud
 */

@Service
public class StorageServiceImpl implements StorageService {

    @Resource
    private StorageMapper storageMapper;

    @Override
    public void decrease(Long productId, Integer count) {
        System.out.println("全局事务ID=" + RootContext.getXID());
        storageMapper.decrease(productId, count);
    }
}
